﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Faust.Andrew.MTG.Player
{
	/// <summary>
	/// Interaction logic for FloatingWindow.xaml
	/// </summary>
	public partial class FloatingWindow : Window
	{
        protected object _content;
        protected DockablePanel _hostPanel;

		public FloatingWindow()
		{
			this.InitializeComponent();
			
			// Insert code required on object creation below this point.
		}

        public FloatingWindow(object content, DockablePanel hostPanel) : this()
        {
            _content = content;
            _hostPanel = hostPanel;
            Content = _content;
        }		

		private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
            if (_content != null)
            {
                Content = null;
                _hostPanel.Content = _content;
                _hostPanel.Attach(_content);
            }
		}
	}
}